Skip to content

mpd: fix build on darwin#457144

Merged
SuperSandro2000 merged 1 commit intoNixOS:masterfrom
kero0:master
Nov 2, 2025
Merged

mpd: fix build on darwin#457144
SuperSandro2000 merged 1 commit intoNixOS:masterfrom
kero0:master

Conversation

@kero0
Copy link
Contributor

@kero0 kero0 commented Oct 31, 2025

Things done

mpd is failing to build on darwin with this error

/nix/store/245wgmjlkq2swfkb138xh1jvb41ag8mh-libcxx-19.1.2+apple-sdk-15.5/include/c++/v1/__format/formatter_floating_point.h:67:30: error: 'to_chars' is unavailable: introduced in macOS 13.3
   67 |   to_chars_result __r = std::to_chars(__first, __last, __value, __fmt);
      |                              ^

This PR fixes the build error by adding "-mmacosx-version-min=13.3" to CXX_FLAGS.

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Oct 31, 2025
@kero0
Copy link
Contributor Author

kero0 commented Oct 31, 2025

This is my first PR here. Please tell me if there's anything I need to change to get this merged 😄

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! labels Oct 31, 2025
@nix-owners nix-owners bot requested a review from tobim October 31, 2025 03:46
@siraben
Copy link
Member

siraben commented Oct 31, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 457144
Commit: ae8a6a5efda5343e2da14de0d25246c770ac8852


aarch64-darwin

✅ 5 packages built:
  • mpd
  • mpd-small
  • mpd-small.doc
  • mpd.doc
  • mpd.man

@tobim
Copy link
Contributor

tobim commented Oct 31, 2025

Thanks for this fix. I'm slightly unhappy about the consequence that many older devices won't be able to run mpd any more, but that is precisely something that many people repurpose them for.

Can you check if this alternative workaround also fixes the build:

diff --git i/pkgs/by-name/mp/mpd/package.nix w/pkgs/by-name/mp/mpd/package.nix
index 3bcc8851ae0a..14f600a77a12 100644
--- i/pkgs/by-name/mp/mpd/package.nix
+++ w/pkgs/by-name/mp/mpd/package.nix
@@ -234,7 +234,13 @@ stdenv.mkDerivation (finalAttrs: {
         substituteInPlace src/output/plugins/OSXOutputPlugin.cxx \
           --replace kAudioObjectPropertyElement{Main,Master} \
           --replace kAudioHardwareServiceDeviceProperty_Virtual{Main,Master}Volume
-      '';
+      ''
+    +
+      lib.optionalString
+        (stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "13.3")
+        ''
+          sed -i "/subdir('time')/d" test/meson.build
+        '';

   # Otherwise, the meson log says:
   #

In case it won't I will approve your change to set the deployment target.

@Rhys-T
Copy link
Contributor

Rhys-T commented Oct 31, 2025

Ran into this same error on a couple of my out-of-tree packages. I managed to track it down to the libc++ change in #398727: The Apple libc++ implements std::format on top of to_chars, which only exists in the newer versions of macOS.

In this case, mpd itself is using fmt rather than the native std::format, so it shouldn't be running into this… but that one test subdirectory is using gtest, which is using std::format.

@kero0
Copy link
Contributor Author

kero0 commented Oct 31, 2025

@tobim I checked your patch and it also worked. I've updated the branch.

@tobim
Copy link
Contributor

tobim commented Oct 31, 2025

@tobim I checked your patch and it also worked. I've updated the branch.

Great, thanks! Please you drop the original commit instead of adding a revert and change the title of the final commit to something like:

mpd: fix build on darwin

@kero0
Copy link
Contributor Author

kero0 commented Nov 1, 2025

Ok. Done 😄

@kero0 kero0 changed the title mpd: fix missing flag on darwin mpd: fix build on darwin Nov 1, 2025
Copy link
Contributor

@tobim tobim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Nov 1, 2025
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/2625

@SuperSandro2000 SuperSandro2000 added this pull request to the merge queue Nov 2, 2025
Merged via the queue into NixOS:master with commit 9bf7e05 Nov 2, 2025
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants